package com.itheima.zhuanhuan;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Random;

public class ycx {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        long start = System.currentTimeMillis();
        for (int i = 0; i < 10000000 ; i++) {
            list.add(i);
        }

        long end = System.currentTimeMillis();
        Random r= new Random();

       // linkedMethod(list, r);
        //ArrayList插入 204
        //LinkedList 插入1351
        for (int i = 0; i < 300000; i++) {

            list.add(15550);
        }

        System.out.println(end-start);

    }
    //5600
    public static void chaxunMethod(LinkedList<Integer> list, Random r) {
        for (int i = 1000000; i <1000300; i++) {
            int numer = r.nextInt(1000000) + 1000000;
            System.out.println(list.get(numer));
        }
    }
}
